package com.zx.zxojbackendjudge.codesandbox;


import com.zx.zxojbackendjudge.codesandbox.impl.ExampleCodeSandBox;
import com.zx.zxojbackendjudge.codesandbox.impl.RemoteCodeSandBox;
import com.zx.zxojbackendjudge.codesandbox.impl.ThirdPartyCodeSandBox;

/**
 * 代码沙箱工厂
 * 作用：统一管理代码沙箱，通过工厂可以获取到对应的代码沙箱
 */
public class CodeSandBoxFactory {
    /**
     * 根据传入的参数获取对应的代码沙箱
     * @param type
     * @return
     */
    public static CodeSandBox newInstance(String type) {
        if (type.equals("remote")) {
            return new RemoteCodeSandBox();
        } else if (type.equals("example")) {
            return new ExampleCodeSandBox();
        } else {
            return new ThirdPartyCodeSandBox();
        }
    }

    public static void main(String[] args) {

    }
}
